package com.ruoyi.appointmentRecord.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.appointmentRecord.mapper.AppointmentRecordMapper;
import com.ruoyi.appointmentRecord.domain.AppointmentRecord;
import com.ruoyi.appointmentRecord.service.IAppointmentRecordService;

/**
 * 预约记录Service业务层处理
 *
 * @author ch
 * @date 2022-07-26
 */
@Service
public class AppointmentRecordServiceImpl implements IAppointmentRecordService
{
    @Autowired
    private AppointmentRecordMapper appointmentRecordMapper;

    /**
     * 查询预约记录
     *
     * @param id 预约记录主键
     * @return 预约记录
     */
    @Override
    public AppointmentRecord selectAppointmentRecordById(Long id)
    {
        return appointmentRecordMapper.selectAppointmentRecordById(id);
    }

    /**
     * 查询预约记录列表
     *
     * @param appointmentRecord 预约记录
     * @return 预约记录
     */
    @Override
    public List<AppointmentRecord> selectAppointmentRecordList(AppointmentRecord appointmentRecord)
    {
        return appointmentRecordMapper.selectAppointmentRecordList(appointmentRecord);
    }

    /**
     * 新增预约记录
     *
     * @param appointmentRecord 预约记录
     * @return 结果
     */
    @Override
    public int insertAppointmentRecord(AppointmentRecord appointmentRecord)
    {
        appointmentRecord.setCreateTime(DateUtils.getNowDate());
        return appointmentRecordMapper.insertAppointmentRecord(appointmentRecord);
    }

    /**
     * 修改预约记录
     *
     * @param appointmentRecord 预约记录
     * @return 结果
     */
    @Override
    public int updateAppointmentRecord(AppointmentRecord appointmentRecord)
    {
        appointmentRecord.setUpdateTime(DateUtils.getNowDate());
        return appointmentRecordMapper.updateAppointmentRecord(appointmentRecord);
    }

    /**
     * 批量删除预约记录
     *
     * @param ids 需要删除的预约记录主键
     * @return 结果
     */
    @Override
    public int deleteAppointmentRecordByIds(Long[] ids)
    {
        return appointmentRecordMapper.deleteAppointmentRecordByIds(ids);
    }


    /**
     * 批量逻辑删除预约记录
     *
     * @param ids 需要删除的预约记录主键
     * @return 结果
     */
    @Override
    public int logicDeleteAppointmentRecord(Long[] ids,String delType,Long delUser)
    {
        return appointmentRecordMapper.logicDeleteAppointmentRecord(ids,delType,delUser);
    }

    /**
     * 删除预约记录信息
     *
     * @param id 预约记录主键
     * @return 结果
     */
    @Override
    public int deleteAppointmentRecordById(Long id)
    {
        return appointmentRecordMapper.deleteAppointmentRecordById(id);
    }
    /**
     * 去重查看预约日期
     * @param storeId
     * @param technicianId
     * @return
     */
    @Override
    public List<String> appointmentDistinct(Long storeId,Long technicianId){
        return appointmentRecordMapper.appointmentDistinct(storeId,technicianId);
    }
}
